home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5139 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.8 KB

  1. Path: news.dfn.de!si-nic!usenet
  2. From: Markus Becker <becker@zess.uni-siegen.de>
  3. Newsgroups: comp.lang.c
  4. Subject: Apology, was: Re: Limit on #bytes inside of struct?
  5. Date: Mon, 12 Feb 1996 15:31:41 +0100
  6. Organization: ZESS, Uni-GH-Siegen
  7. Message-ID: <311F4F4D.7784@zess.uni-siegen.de>
  8. References: <4feg1d$d4g@cville-srv.wam.umd.edu> <4ffg6b$ivd@sparcserver.lrz-muenchen.de> <4ffohq$1gb@mordred.gatech.edu> <4ffun7$1l4l@cymbal.aix.calpoly.edu> <311F15D8.78D1@zess.uni-siegen.de> <9602121217.AA07160@dxmint.cern.ch>
  9. NNTP-Posting-Host: becker.zess.uni-siegen.de
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
  14.  
  15. Ok, this one, to get my face back :)
  16.  
  17. Dan Pop wrote:
  18. > I wrote:
  19. > >No it isn't, see below.
  20. > >
  21. > >>    typedef struct {
  22. > >>       int the_array[50000];
  23. > >>    } struct_type;
  24. > >>
  25. > >
  26. > >This way, you don't put the 50K numbers in the struct, but only
  27. > >a pointer to them. Should be at most 4 bytes.
  28. > Why do clueless people insist on posting their answers and corrections,
  29. > making fools of themselves in front of the whole world is beyond me.
  30.  
  31. Because making mistakes is human (or something like that).
  32.  
  33. > Please take these two mandatory steps before posting your answers and
  34. > objections to other people's answers to c.l.c:  ^^^^^^^^^^
  35.  
  36. There weren't any objections meant in my post. Or is my understanding
  37. of "objection" as wrong as I was on the subject?
  38.  
  39. > 1. Learn C.  A _good_ book will help a lot.
  40.  
  41. I think I know C. And also know of good books. No problem.
  42.  
  43. > For the technical part of the article:
  44. > o I'm typing this on a system where pointers are 8 bytes and I do know
  45. >   a system which has 16-byte pointers (and is in current use today).
  46.  
  47. Ok, at most/at least *is* a difference (besides the fact that I was
  48. wrong).
  49.  
  50. > o Try printing the value of sizeof(struct_type).  The most likely
  51. >   results are 100000 and 200000 (that is, if you use the correct
  52.  
  53. Did it. 200000. But that was clear as soon as I thought about alloc'ing such
  54. a structure.
  55.  
  56. > o As steps #1 and #2 mentioned above will show you, an array decays into
  57. >   a pointer only when used in a value context.  And, of course, pointers
  58. >   and arrays are _not_ equivalent and cannot be used interchangeably.
  59.  
  60. I had a sentence somewhere in the back of my mind "that arrays and pointers
  61. in C are equivalent and completely interchangeable". Could it be K&R?
  62.  
  63. > >http://www.zess.uni-siegen.de/private/becker/win95
  64. >                                               ^^^^^
  65. >                      Could this explain the confusion of the poster? :-)
  66.  
  67. Maybe:) If you deal with the kind of problems you come across when
  68. implementing Software using such a "system", some things can get lost.
  69.  
  70. I've shot too fast. Next time I will think twice.
  71. --
  72. Markus Becker
  73.